using FireStarterModeller.BO;
using Habanero.Testability;

namespace FireStarterModeller.Test
{
    public class TestUtilsDMLookupListDatabase
    {
        public static BOTestFactory<DMLookupListDatabase> GetBuilder()
        {
            return BOTestFactoryRegistry.Instance.Resolve<DMLookupListDatabase>();
        }

        /// <summary>
        /// Creates a new saved DMLookupList with a random value assigned to every property
        /// </summary>
        public static DMLookupListDatabase CreateSavedDMLookupListDatabase()
        {
            DMLookupListDatabase dMLookupList = CreateUnsavedValidDMLookupListDatabase();
            dMLookupList.Save();
            return dMLookupList;
        }

        /// <summary>
        /// Creates a new unsaved DMLookupList with a random value assigned to every property
        /// </summary>
        public static DMLookupListDatabase CreateUnsavedValidDMLookupListDatabase()
        {
            return GetBuilder()
                .CreateValidBusinessObject();
        }
        /// <summary>
        /// Creates a new unsaved DMLookupList with a random value assigned to every property
        /// </summary>
        public static DMLookupListDatabase CreateStandardDMLookupListDB()
        {
            return GetBuilder()
                .WithValue(dbLList => dbLList.Generated, true)
                .WithValue(dbLList => dbLList.Sql, "SQL")
                .WithValue(dbLList => dbLList.LookupClassName, "LookupClassName")
                .WithValue(dbLList => dbLList.Assembly, "Assembly")
                .WithValue(dbLList => dbLList.TimeOut, 4)
                .WithValue(dbLList => dbLList.LimitToList, false)
                .CreateValidBusinessObject();
        }

        /// <summary>
        /// Creates a new unsaved DMLookupList where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static DMLookupListDatabase CreateUnsavedDefaultDMLookupListDatabase()
        {
            DMLookupListDatabase dMLookupList = new DMLookupListDatabase();
            return dMLookupList;
        }
    }
}